<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script>
        /* 
            猜数字游戏：
        */
       //生成随机数字
        function getRandomArbitrary(min, max) { 
                   return Math.random() * (max - min) + min;
              }

              var randomNumber = Math.floor(getRandomArbitrary(1,11))
              alert(randomNumber)
              while(true){
                  var input = parseInt(prompt("输入你猜的数字1~10"))
                  if(input>randomNumber){
                      alert("猜大了")
                  }else if(input<randomNumber){
                      alert("猜小了")
                  }else{
                      alert("答对了")
                      break;
                  }
              }
    </script>
</head>
<body>
    
</body>
</html>